home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / The World of Computer Software.iso / nnans193.zip / NNANSI.DOC < prev    next >
Text File  |  1993-01-15  |  42KB  |  1,105 lines

  1.        NNANSI.COM-- Enhanced MS-DOS ANSI Console Driver
  2.              For EGA/VGA Displays
  3.  
  4. Note: MS-DOS and Windows are trademarks of Microsoft Corporation.
  5. PC/XT, PC/AT, and PS/2 are trademarks of IBM Corporation.
  6. 4DOS is a trademark of J.P. Software.
  7. MKS Toolkit is a trademark of Mortice Kern Systems Inc.
  8. PROCOMM is a trademark of Datastorm Technologies, Inc.
  9. Typing Tutor IV is a trademark of Kriya Systems, Inc.
  10. Desqview and QEMM are trademarks of Quarterdeck.
  11. 386MAX is a trademark of Qualitas.
  12.  
  13. Manufacturers' names are the trademarks of their respective manufacturers.
  14. That should take care of everyone.
  15.  
  16. Documentation for version 1/93.
  17.  
  18. This version of NNANSI contains the following improvements
  19. over NNANSI version 9/92:
  20.  
  21. 1. Support of DOS/V, the Japanese version of MS/DOS. (thanks, Akira Kikuchi!)
  22.  
  23. 2. Optional support of extended (101+ key) keyboard added, about a
  24.    decade late.
  25.  
  26. 3. ANSI state machine code straightened out. Keyboard remapping function 
  27.    fixed.
  28.  
  29.  
  30. IMPORTANT NOTE: the compiled NNANSI.COM is intended for 80286 or later
  31.    systems with "AT" style (12 function key) keyboards and VGA displays. You 
  32.    will need to recompile on systems that don't meet this requirement.
  33.  
  34.  
  35. *********INTRODUCTION
  36.  
  37. NNANSI.COM (version 1/93) is an improved version of NANSI.SYS
  38. (version 2.2), by Daniel Kegel, which is in turn such an improvement
  39. over ANSI.SYS that *no one* should be without one of these.
  40.  
  41. If you are using ANSI.SYS, be aware that either of these drivers
  42. will offer greatly improved performance and functionality over
  43. your current driver. Current users of NANSI.SYS with EGA or VGA
  44. displays (and other enhanced ANSI.SYS drivers) will notice still
  45. greater performance and functionality in NNANSI.SYS.
  46.  
  47. Even if you don't use an ANSI.SYS driver, you will achieve major 
  48. performance benefits. (Note that there will be no performance
  49. benefits for programs that write directly to the display).
  50.  
  51.  
  52. A short list of improvements of NANSI.SYS (version 3.0) over
  53. ANSI.SYS: 
  54.  
  55. 1. Intrinsic 43 or 50 line support (MS-DOS 4.0 now has this).
  56.  
  57. 2. Some additional text mode escape sequences: Insert Lines,
  58.         Delete Lines, Insert Characters, Delete Characters.
  59.  
  60. 3. Greater to *much* greater performance.
  61.  
  62. 4. Supports higher resolutions, both text and graphic modes.
  63.  
  64. 5. Graphic mode cursor
  65.  
  66.  
  67. A short list of improvements of NNANSI.COM (version 1/93) over
  68. NANSI.SYS:
  69.  
  70. 1. Additional escape sequences: erase to start/end of display,
  71.         insert/delete lines in graphic modes, added Set Graphic
  72.         Rendition codes (and properly working reverse video,
  73.     underline, and invisible modes). Accurate ANSI escape 
  74.     sequence parsing
  75.  
  76. 2. Graphic cursor support is better, and can be disabled.
  77.  
  78. 3. Intrinsic support for both 43 and 50 line modes on a VGA. The
  79.     prompt command can be used to maintain 43 or 50 line display
  80.     modes. 40 column support for 43 and 50 line modes.
  81.  
  82. 4. Faster text mode performance; *much* faster scrolling
  83.         (when in "fast mode").
  84.  
  85. 5. Much faster performance in 640x350 to 800x600 16 color
  86.         graphic modes. Every ANSI control sequence (except
  87.         insert/delete characters and blink) work in these modes
  88.         as well.
  89.  
  90. 6. Readily configured for enhanced graphic and text modes of
  91.         various display cards. Support for several popular cards
  92.         are provided.
  93.  
  94. 7. Blink in 16 color graphics modes (up to 800x600) will exclusive-OR
  95.     characters.
  96.  
  97. 8. Support for MS-DOS V4.0 and later MODE commands, and properly
  98.     clears the display in enhanced modes using command.com's CLS.
  99.  
  100. 9. Driver can be loaded as TSR from the command line.
  101.  
  102. 10. Desqview aware.
  103.  
  104. 11. Supports Japanese DOS/V
  105.  
  106. On the other hand, NANSI is smaller, and works with MDA as distributed.
  107.  
  108.  
  109.  
  110. **********************LICENSE REQUIREMENTS
  111.  
  112. Daniel Kegel is the author of NANSI.SYS, of which this is a derived
  113. work. I, Tom Almy, think enough of his efforts and programming skills
  114. that I used NANSI.SYS as a base for NNANSI.COM. NANSI.SYS version 2.2
  115. came with sources and free distribution for personal or educational
  116. use, but prohibits commercial use.  I have an agreement with Mr.
  117. Kegel to license NNANSI.COM in accordance with his newest NANSI.SYS
  118. license arrangement:
  119.  
  120. "If you use this program for education or at home, you are
  121. encouraged to send a US$10 donation to the author.  If you use
  122. it for business purposes, you are required to purchase a
  123. right-to-use license by sending US$10 to the author."
  124.  
  125. Send contributions/user fees to:
  126.  
  127.         Daniel Kegel
  128.         535 E. Mendocino St
  129.         Altadena, CA  91001
  130.  
  131. You can also reach him at his internet address:
  132.  
  133. dank@blacks.jpl.nasa.gov
  134.  
  135.  
  136. Everyone wins with this arrangement!
  137.  
  138. * Commercial users can now legally use NNANSI.COM
  139.  
  140. * Personal users can show their gratitude.
  141.  
  142. * Daniel Kegel can make a little money for his efforts.
  143.  
  144. * I won't feel guilty for "ripping off" his work.
  145.  
  146.  
  147. I place no restrictions on my modifications to NANSI.SYS. I
  148. neither request nor will I accept any contributions for my work
  149. on this program. I made these modifications as part of an effort
  150. to understand the workings of DOS device drivers and the EGA/VGA
  151. display. 
  152.  
  153. On the other hand, I do like to hear from users, satisfied or
  154. (even) not satisfied. 
  155.  
  156.             I M P O R T A N T
  157. >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
  158. Please, if you have problems, check the PROBLEMS section of this
  159. document before contacting me. Greater than 90% of the problem
  160. reports I receive are answered in this section.
  161. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  162.  
  163. My address is:
  164.  
  165.         tom.almy@tek.com        (Internet)
  166.  
  167. or
  168.  
  169.         Tom Almy
  170.         17830 SW Shasta Trail
  171.         Tualatin, OR 97062
  172.  
  173. I also now run a BBS at (503)-620-0307, 1200-9600 (v.32) bps
  174.  
  175. If you must use the postal service. Enclose a stamped, self-
  176. addressed envelope if you desire a reply.
  177.  
  178.  
  179. *********DISTRIBUTED FILES
  180.  
  181. The distribution has the following files:
  182.  
  183.     readme.1st    - READ THIS FIRST
  184.         nnansi.com      - Driver, with compilation options set as shown
  185.                         - in the file CONFIG.INC
  186.         nnansi.doc      - this file
  187.     howto.doc    - explaination about the different ways to
  188.               write to the display
  189.         gcon.bat        - turns graphic cursor on
  190.         gcoff.bat       - turns graphic cursor off
  191.         fast.bat        - turns fast mode on
  192.         slow.bat        - turns fast mode off
  193.     biosw.bat    - turns ANSI bios write_tty on
  194.     nobiosw.bat    - turns ANSI bios write_tty off
  195.     25.bat        - set 80x25 text mode
  196.     43.bat        - set 80x43 text mode
  197.     50.bat        - set 80x50 text mode (VGA only)
  198.     run.bat        - load NNANSI TSR as full function driver
  199.     norun.bat    - unload NNANSI TSR when loaded as full
  200.               function driver
  201.  
  202.     dtest.exe    - Performance testing program for ANSI drivers
  203.     stat.com    - Print out information about display status
  204.  
  205.         makefile        - for Don Kneller's NDMAKE
  206.         nnansi.asm      - The source file
  207.     config.inc    - Configuration selections (part of source)
  208.     drivers.inc    - Display specific macros (part of source)
  209.  
  210.  
  211.  
  212. *********INSTALLATION
  213.  
  214. NOTE: If you have an MDA (Monochrome or Hercules display adapter) you
  215. will need to reassemble NNANSI first. You will also need to
  216. reassemble if you are using DOS/V, an 8088 processor, an EGA display,
  217. or an original 84 key keyboard. You will probably want to reassemble
  218. to configure for your specific display card (if it is an "Enhanced"
  219. card), will not be using Desqview, are using a DOS prior to version
  220. 4.0, or otherwise want other defaults.
  221.  
  222. NNANSI installs just like ANSI.SYS (or NANSI.SYS), it is a device
  223. driver that you specify in your CONFIG.SYS file:
  224.  
  225.         DEVICE=NNANSI.COM
  226.  
  227. If you are using code pages, place this command before the 
  228. DEVICE=DISPLAY.SYS command, otherwise code pages will not work.
  229.  
  230. You can also load NNANSI as a TSR (Terminate and Stay Resident)
  231. program instead. To do this, add the following lines to your
  232. AUTOEXEC.BAT file:
  233.  
  234.     NNANSI D
  235.     CTTY CON
  236.  
  237. If you wish to load the driver as a TSR in Desqview or Windows, 
  238. see the section on "NNANSI as a TSR". You cannot use the D option,
  239. and the CTTY command is not needed but the driver will have limited
  240. features.
  241.  
  242. If NNANSI is the last TSR loaded, it can then be removed. See the
  243. section "NNANSI as a TSR" for the special technique necessary to
  244. remove NNANSI.
  245.  
  246. For optimum performance, run fast.bat and biosw.bat, but if
  247. applications have trouble with either of these, you will have to
  248. revert back to slower operating modes (read section "FAST MODE").
  249.  
  250. While the supplied compiled driver is suitable for most
  251. installations, you can get better results by customizing the driver
  252. for your display card. To do this you will need an assembler, such as
  253. Borland Turbo Assembler, a text editor, and (optionally) Don
  254. Kneller's NDMAKE program. I understand that Borland's MAKE will also
  255. work.
  256.  
  257. Some people have asked why I don't have command line options for
  258. the driver or a separate configuring program but require the user to
  259. use an assembler. The reasons:
  260.  
  261. 1. These make the driver larger and possibly slower than it needs to be.
  262.    If you insist on a full-featured display driver try FANSI-CONSOLE.
  263. 2. I feel that users who are sophisticated enough to be able to utilize
  264.    NNANSI either have an assembler or have access to one. This is not
  265.    a program for novices.  
  266. 3. I'm lazy. I'm not interested. I've got other things to do (which pay).
  267.  
  268. All options are specified in the file CONFIG.INC. Edit that
  269. file and make changes as appropriate. These descriptions assume
  270. the initial default settings:
  271.  
  272. DOSV    (FALSE)
  273.     Set true to use with DOS/V. This option will eliminate most of 
  274.         NNANSI's performance improvements.
  275.  
  276. VGA     (TRUE)
  277.         If you have an EGA display, set this to FALSE. You might
  278.         also want to set this to FALSE if you have a VGA and are
  279.         used to the ESC [=43h sequence giving 50 line mode.
  280.  
  281. EGA     (FALSE)
  282.         If you have an EGA, set this to TRUE.
  283.  
  284. MONO    (FALSE)
  285.     Must be TRUE if you have a Monochrome Display Adapter (MDA)
  286.     or Hercules card either as your sole display or in addition
  287.     to a color display controller. If you don't, leave this FALSE
  288.     as it both hurts performance and enlarges the driver. You cannot
  289.     use an MDA with Desqview and NNANSI at the same time.
  290.  
  291. TSR    (set on tasm command line)
  292.     If TRUE, compiles TSR/DRIVER COM file version, otherwise compiles 
  293.     DRIVER only, SYS file version.
  294.  
  295. DESQVIEW (TRUE)
  296.     If TRUE, and TSR is TRUE, compiles DESQVIEW awareness code.
  297.     If you don't intend to use DESQVIEW you should set this to
  298.     FALSE.
  299.  
  300. VESA    (FALSE)
  301.     Set TRUE if you have a VESA compatible display card BIOS.
  302.     You will also need to have a particular display specified
  303.     for best results. VESA has been successfully tested with
  304.     a Diamond Speedstar card (TSENG4000 set TRUE) and using
  305.     Diamond's VESA BIOS extension, and with a Diamond Steath
  306.         with built in VESA support. When using built in VESA, there
  307.     seems to be a problem in selecting graphics modes via their
  308.     VESA mode numbers.
  309.  
  310.  
  311. VEGA, PARADISE, STBVGA...  (all FALSE)
  312.         Set only one of these TRUE to match your enhanced
  313.         EGA/VGA display card. If you have a card not on the list
  314.         and experience problems with either blotches in enhanced
  315.         text mode or poor performance (unsettable background
  316.         colors is a clue) in graphics modes CONTACT THE AUTHOR.
  317.  
  318. BAD_ERASE    (FALSE, except if TSENG4000 selected)
  319.     Set to true if erase to end of line and erase to start/end of
  320.         screen erase the wrong portion of the display
  321.  
  322. cheap_pc (FALSE)
  323.         Set to FALSE for "PC/AT" and "PS/2" class machines which
  324.     have 80186 or greater processors.
  325.  
  326. ext_keybd (TRUE)
  327.     Set to TRUE for "PC/AT" and "PS/2" class machines with 101+ key
  328.     keyboards (the kind with 12 function keys and separate cursor keys
  329.     from the numeric pad).
  330.  
  331. key_redef (FALSE)
  332.         Set to TRUE if you use key redefinition. There are
  333.         Trojan Horse programs that take advantage of this
  334.         feature, and most people don't use it anyway, so the
  335.         default is FALSE.
  336.  
  337. init_buffer_size (256)
  338.         Enlarge if you use key redefinition and don't have
  339.         enough room.
  340.  
  341. quick_char (TRUE)
  342.         Faster graphics display in 16 color modes, at cost of
  343.     much extra code since this involves added display
  344.     routines. Must be TRUE if gbackground is also TRUE.
  345.  
  346. fast29  (TRUE)
  347.         Makes int29 display calls (used by DOS) 15% faster at a
  348.         cost of about 100 bytes.
  349.  
  350. bios_write_tty (TRUE)
  351.         The write tty BIOS call is taken over. It will now
  352.         perform faster and understand ANSI escape sequences. This
  353.     latter feature can be a mixed blessing. This feature can be
  354.     disabled at runtime if it is assembled in.
  355.  
  356. gbackground (TRUE)
  357.         Enables setting of non-black background color in 16 color
  358.     graphic modes (640x350 to 800x600 resolutions). If set to
  359.     TRUE, quick_char must also be set to TRUE. If this feature is
  360.     not desired, it is possible (depending on the system) to get
  361.     greater performance by defining both gbackground and
  362.     quick_char FALSE. This will also save quite a bit of
  363.     code. Experiment and see for yourself.
  364.  
  365. dos4 (TRUE)
  366.         Under MS/PC DOS version 4.0 (and 5.0) allows command.com and
  367.     mode.com to recognize NNANSI as an ANSI driver. If you are
  368.     using older DOS versions, you can define this to be FALSE.
  369.  
  370. initgc  (FALSE)
  371.         Graphic mode cursor is initially off. You can turn it on/off
  372.     with a control sequence.
  373.  
  374. initfast (FALSE)
  375.         Fast scroll mode is initially off. This also means that
  376.         multiple page support is initially on. You can turn it on/off
  377.     with a control sequence, and there are other work-arounds as
  378.     well.
  379.  
  380. initbiosw (FALSE)
  381.     ANSI bios write_tty is initially off. You can turn it on/off
  382.     with a control sequence.
  383.  
  384.  
  385. You can then either use the supplied makefile to generate a new
  386. nnansi.sys/nnansi.com or assemble manually as shown (Borland tools
  387. illustrated): 
  388.  
  389. tasm /m5 /DTSR=0 nnansi          (Use /m5 for version 2.0 or later)
  390. tlink nnansi,nnansi.sys/m/t     (generates nnansi.sys for config.sys)
  391.  
  392. tasm /m5 /DTSR=1 nnansi
  393. tlink nnansi,nnansi.bin/m/t    (generates nnansi.com for config.sys
  394. rename nnansi.bin nnansi.com     or TSR use)
  395.  
  396. The .sys driver offers no advantages other than it takes less memory
  397. while loading (this might be a consideration with some high memory
  398. management programs). For this reason, a .sys version is no longer
  399. distributed.
  400.  
  401.  
  402. IMPORTANT NOTE FOR USERS OF BORLAND TURBO ASSEMBLER V3.0: 
  403.  
  404. There is a bug in this version which causes the assembler to hang
  405. when assembling the sys version of NNANSI. The solution is to only
  406. build the com version. The bug is fixed with V3.1.
  407.  
  408.  
  409. NOTE FOR MICROSOFT MASM USERS:
  410.  
  411. With the Microsoft assembler, you will need to make some changes to
  412. the source to avoid the branch out of range errors, and you will need
  413. to use the exe2bin program to convert the linker generated exe file
  414. into a binary image file, which you then have to rename to
  415. NNANSI.SYS or NNANSI.COM.
  416.  
  417. To correct the branch out of range, you will need to replace the conditional
  418. branch with an conditional branch of the opposite sense around an
  419. unconditional branch to the same destination. Example:
  420.  
  421.     jne    foo    ; original statement, now "out of range"
  422.  
  423. becomes:
  424.  
  425.     je    new_label
  426.     jmp    foo
  427. new_label:
  428.  
  429.  
  430. You will also need to delete the first few lines in NNANSI.ASM, which
  431. are directives for the Borland Assembler.
  432.  
  433.  
  434. **************NNANSI AS A TSR**
  435.  
  436. NNANSI can now be loaded as a TSR in two modes, limited and full. If
  437. you intend to use NNANSI as a TSR, such as in a Desqview window, or
  438. for temporary use, please read this section carefully.
  439.  
  440.  
  441. To load NNANSI in full driver mode, execute the following two commands
  442. (or execute run.bat):
  443.  
  444. nnansi d
  445. ctty con
  446.  
  447. This will load the driver such as it runs identically to NNANSI loaded
  448. as a driver in CONFIG.SYS. This means that not only does it take control
  449. of several interrupt vectors, the driver is also linked into the DOS
  450. driver chain. The CTTY command is necessary to force command.com to 
  451. "reopen" its console interface to use the NNANSI driver.
  452.  
  453. This method must not be used within a multitasking environment such
  454. as Microsoft Windows or Desqview, because the relinking of the driver
  455. chain corrupts system integrity. However it may be used to load
  456. NNANSI before running Windows. In the Desqview case, a batch file can
  457. be used to unload NNANSI, run Desqview, and then reload NNANSI when
  458. finished.
  459.  
  460. Within each DOS window in Windows or Desqview, the limited version of the
  461. NNANSI TSR can be loaded (described below). The copy of NNANSI should
  462. be unloaded before closing the DOS window.
  463.  
  464. NNANSI in full driver mode can be unloaded using the following procedure
  465. providing it is the last TSR loaded, you are not "shelled out" of a program,
  466. are running the same instance of COMMAND.COM, and did not load NNANSI
  467. "high" using QEMM, 386/MAX, or DOS 5.0. From a batch file, execute:
  468.  
  469. @echo off
  470. nnansi u
  471. ctty con
  472.  
  473. The ctty command must be executed immediately after the NNANSI command,
  474. otherwise the system may "crash". The batch file norun.bat is provided
  475. to unload NNANSI.
  476.  
  477. Note that full driver mode NANNSI must be uninstalled using NNANSI, and
  478. not with a TSR management program. Such programs are incapable of
  479. unchaining NNANSI from the device driver list.
  480.  
  481. --------------------
  482.  
  483. NNANSI also has a limited TSR mode. In this mode the driver is not
  484. linked into the DOS driver chain. To load NNANSI in limited mode execute:
  485.  
  486. nnansi
  487.  
  488. In limited mode the device status report will not function, nor will
  489. keyboard key reassignment. The DOS MODE command will not change the
  490. number of display lines either. Also the performance improvement for
  491. RAW mode (which gives NNANSI its greatest performance) will not be
  492. available.
  493.  
  494. You can unload NNANSI which has been loaded in limited mode by executing:
  495.  
  496. nnansi u
  497.  
  498.  
  499. The limited TSR mode driver can be used in a Microsoft Windows or Desqview
  500. window without problems. You can also uninstall the limited mode driver
  501. with a TSR management program.
  502.  
  503.  
  504.  
  505. **************HOW MUCH PERFORMANCE IMPROVEMENT IS THERE?
  506.  
  507. I have performed considerable testing on an EVEREX 25Mhz 80386
  508. machine with a Video 7 (Headland) Fastwrite VGA display controller
  509. (and its BIOS), under both DOS 3.3 and 4.0. Your results will
  510. probably vary, and BIOS performance without NNANSI will also improve
  511. if the EGA/VGA BIOS is copied to RAM as supported by some vendors and
  512. also possible with QEMM or 386/MAX on 80386 based systems.
  513.  
  514. Performance is proportional to roughly independent factors, writing
  515. speed and scrolling speed. Writing speed is the rate at which
  516. characters can be drawn on the display without the display scrolling.
  517. Scrolling speed is the rate at which the display can scroll (no
  518. new characters are drawn). Writing speed tends to be independent of
  519. display mode (except graphic modes are slower), while scrolling speed
  520. tends to be proportional to the number of character positions on the
  521. display (except for NNANSI fast mode, which is independent of screen
  522. size). 
  523.  
  524. When using ANSI.SYS rather than no driver at all, there is roughly a
  525. 2.3x degradation in performance for writing. Scrolling performance
  526. improves 44% when DOS 4.0 ANSI driver is used, but remains unchanged
  527. with the DOS 3.3 driver.
  528.  
  529. Compared to no driver, NANSI.SYS (3.0) is 3x to 3.5x faster for
  530. writing, and is roughly 45x faster when writing using DOS in RAW
  531. mode. It is roughly 2x faster scrolling.
  532.  
  533. Compared to the no driver or other ANSI drivers, NNANSI is 4x faster
  534. in BIOS TTY write calls. 
  535.  
  536. Compared to NANSI.SYS it is 2x faster in INT29 calls, 73% faster in
  537. DOS write calls, but there is no speedup in RAW mode. When fast mode
  538. is used, scrolling is 15x to 25x faster.
  539.  
  540. This means that text mode programs that take advantage of RAW
  541. mode and buffering can display 100 times faster with NNANSI (and
  542. without scrolling, NANSI) over ANSI.SYS. It works out to about
  543. 420,000 characters per second with my fast machine.
  544.  
  545. NNANSI also has speedups for 16 color graphic modes with resolutions
  546. between 640x350 and 800x600. With the graphic cursor turned on, the
  547. TTY BIOS call is about 10% slower than the standard BIOS call (which
  548. doesn't display a cursor), but other output calls are 2.5x to 3.5x
  549. faster than that of NANSI.SYS. Turning the graphics cursor off
  550. roughly doubles the writing speed of all modes but RAW.
  551.  
  552.  
  553.  
  554. **************FAST MODE  **READ THIS!!**
  555.  
  556. To get maximum speed, NNANSI has what I call Fast Mode. In text
  557. mode, there is more display memory than there are character on
  558. the display. Normally, the BIOS supports display "pages" that you
  559. can switch among. Changing the display page changes the region
  560. of the display memory that is sent to the display. Fast Mode
  561. uses the same technique (changing the starting location of the
  562. viewable memory region) to scroll the display upwards. 
  563.  
  564. Programs that make use of multiple display pages and scroll the
  565. display require that fast mode be turned off. Many debugging programs
  566. use two pages to maintain separate debugging and application
  567. displays. Some of the programs will still work in fast mode if they
  568. have a "swap screens" option ("-ds" for Borland Turbo Debugger, for
  569. instance).
  570.  
  571. A number of programs that directly access the display don't work if
  572. starting address has changed. These programs may not work properly in
  573. fast mode (or for that matter in display pages other than the first).
  574. NNANSI tries its best to work with these programs by resetting the
  575. display start location if any program does the "get display mode" or
  576. "scroll/clear display" BIOS calls. These calls are typically done by
  577. potentially offending applications when they start. As long as the
  578. display never scrolls under NNANSI control everything will work fine.
  579. A typical problem occurs in programs that have DOS or "shell escape"
  580. commands. If the DOS sub-shell (invocation of COMMAND.COM) causes the
  581. display to scroll, then upon exiting the sub-shell the display will
  582. be ruined. The solution to this problem (other than not using fast
  583. mode) is to clear the screen just before exiting the sub-shell.
  584.  
  585. Please note that Windows 3.0 in Enhanced Mode has problems with DOS
  586. applications running in a window using NNANSI's fast mode. You will
  587. need to run Windows with NNANSI in slow mode.
  588.  
  589. Some offending programs can be "fixed" by invoking them from a
  590. batch file (or alias if you use MKS Toolkit, 4DOS, ANARKEY...)
  591. which first clears the screen. Or you can use a batch file which
  592. turns off fast mode, then turn fast mode back on again after
  593. program execution. Example:
  594.  
  595. echo ^[[=98l
  596. offendingpgm %1 %2 %3 %4 %5
  597. echo ^[[=98h
  598.  
  599. Where "^[" is the escape (code 27) character.
  600.  
  601. Batch programs have been provided to enable (fast.bat) and disable
  602. (slow.bat) fast mode.
  603.  
  604.  
  605. NNANSI can also speed up programs that use BIOS calls for writing
  606. characters. NNANSI adds the ANSI features to such calls, which can
  607. cause problems with some applications. This feature is turned off by
  608. default, but can be enabled via an ANSI sequence or by executing the
  609. supplied batch file biosw.bat. The feature can be disabled with
  610. nobiosw.bat.
  611.  
  612.  
  613. ******************WRITING PROGRAMS FOR BEST PERFORMANCE
  614.  
  615.  
  616. To get best performance in programs you write, you must put the
  617. display in RAW mode, and buffer output.
  618.  
  619. In assembler, you can set raw mode with the following sequence
  620. (adapt this for other languages):
  621.  
  622.         mov     ax,4400h        ; get device status
  623.         mov     bx, 1           ; of device 1 (standard output)
  624.         int     21h
  625.         xor     dh, dh          ; clear upper byte
  626.         mov     saved_state, dx ; save it for later
  627.         mov     ax, 4401h       ; set new status
  628.         or      dl, 20h         ; with raw bit set
  629.         int     21h
  630.  
  631. Reset raw mode before terminating the application:
  632.  
  633.         mov     ax, 4401h       ; set status to original values
  634.         mov     bx, 1
  635.         mov     dx, saved_state
  636.         int     21h
  637.  
  638. There is a fixed amount of overhead (and it is high) for each
  639. DOS call. Therefore you should buffer up write requests into a
  640. single call. With the C language, you can use the setvbuf() call
  641. to set a large buffer size.
  642.  
  643. Even if you don't follow this advice, you will get a major
  644. performance improvement over ANSI.SYS (or no device driver at
  645. all). 
  646.  
  647. Programs using RAW mode and buffering easily beat the
  648. performance of the supposedly high speed console drivers
  649. supplied in Turbo C and Microsoft C. And by using ANSI control
  650. sequences your programs can be made portable to other systems!
  651.  
  652.  
  653. *****************TYPICAL PROBLEMS
  654.  
  655.  
  656. ALSO READ THE SECTION "FAST MODE"
  657.  
  658.  
  659. SYSTEM CRASHES UPON BOOTING, OR DISPLAY BADLY CORRUPTED EVEN IN
  660. STANDARD 80x25 TEXT MODE.
  661.  
  662. You have assembled NNANSI with cheap_pc set to FALSE on an 8088 based
  663. system, or you are trying to use NNANSI on an MDA or Hercules
  664. Graphics equipped system without reassembling with MONO equal TRUE.
  665.  
  666. This can also happen if you are using DOS/V with NNANSI not compiled for
  667. DOS/V operation.
  668.  
  669.  
  670. KEYBOARD IS "LOCKED"
  671.  
  672. You have set ext_keybd TRUE when you have an original style (10 function
  673. key) keyboard, or a BIOS that does not support the extended keyboard.
  674.  
  675.  
  676. ON A VGA, SETTING 43 LINE MODE GIVES 43 LINES, WHEN IT GAVE 50
  677. WITH AN OLDER VERSION OF NNANSI.SYS OR WITH NANSI.SYS
  678.  
  679. This is correct. There is now a new setting for 50 line mode. If
  680. you require that 43 line mode give 50 lines, recompile the
  681. system with VGA set to FALSE.
  682.  
  683.  
  684. I USED AN EARLIER VERSION OF NNANSI, AND NOW I FIND THAT NNANSI IS
  685. MUCH SLOWER THAN BEFORE
  686.  
  687. The defaults have changed. You now have to run FAST and BIOSW for
  688. fastest operation.
  689.  
  690.  
  691. I USED AN EARLIER VERSION OF NNANSI, AND NOW FIND MY DISPLAY 
  692. INEXPLICABLY CHANGING MODES
  693.  
  694. The commands for graphic cursor, fast mode, and line wrap are 
  695. more restrictive. Use the new batch files for fast, slow, gcon, and
  696. gcoff, and change any code of your own appropriately.
  697.  
  698.  
  699. ON A VGA, SETTING 50 LINE MODE CAUSES VERY STRANGE BEHAVIOR
  700.  
  701. Two possibilities. Your display adapter is really an EGA, or you
  702. have compiled NNANSI with VGA set to FALSE. In the latter
  703. case, you can get 50 line mode by setting 43 line mode, while in
  704. the former case you can't get 50 line mode at all.
  705.  
  706.  
  707. ON A VGA, AFTER LEAVING 43/50 LINE MODE THE CURSOR IS IN THE
  708. MIDDLE OF THE CHARACTER BLOCK
  709.  
  710. Recompile the driver with EGA set to FALSE.
  711.  
  712.  
  713. ON AN EGA, THE CURSOR DISAPPEARS IN 43 LINE MODE WHEN RUNNING
  714. SOME APPLICATIONS
  715.  
  716. There is nothing you can do, as this is caused by an error in
  717. the design of the EGA BIOS.
  718.  
  719.  
  720. IN 43/50 LINE MODE, THE DOS CLS COMMAND ONLY CLEARS THE FIRST 25
  721. LINES OF THE DISPLAY (DOS 4.0)
  722.  
  723. Reassemble with "dos4 EQU TRUE", as it is in the distribution NNANSI
  724. driver.
  725.  
  726.  
  727. DISPLAY SHOWS UGLY BLOCKS AT THE START AND END OF EACH LINE OR
  728. PERFORMANCE SLOWS GREATLY IN EXTENDED (GREATER THAN 80X25) TEXT MODES 
  729.  
  730. Your display controller sets the display mode byte in the BIOS to
  731. some value other than "3". You can either set the byte (at location
  732. 40:49h) back to 3 after setting the display mode, or configure NNANSI
  733. to know about these special modes. This problem is typical for most
  734. cards, it seems. There may already be a proper configuration for your
  735. display in CONFIG.INC. 
  736.  
  737.  
  738. DISPLAY IS NOTICEABLY SLOWER WRITING OR CANNOT SWITCH BACKGROUND
  739. COLORS IN EXTENDED (GREATER THAN 640x480, OR 640x350 EGA)
  740. GRAPHIC MODES
  741.  
  742. In 256 color modes or 1024x768 modes, the background color cannot be
  743. changed. In other modes, you will need to configure NNANSI for your
  744. display card.  Look for a proper configuration in CONFIG.INC.
  745.  
  746.  
  747. DISPLAY GOES BLANK WHEN STARTING AN APPLICATION. DISPLAY SHIFTED
  748. PARTLY OFF SCREEN WHEN STARTING AN APPLICATION. DISPLAY
  749. DISAPPEARS DURING EXECUTION OF A APPLICATION.
  750.  
  751. First try clearing the screen before execution. If that doesn't
  752. work, leave fast mode (see preceding section on FAST MODE).
  753.  
  754.  
  755. FUNNY BLOTCHES OCCASIONALLY APPEAR AT VARIOUS POINTS IN A
  756. GRAPHIC APPLICATION
  757.  
  758. This is the graphics cursor. You can disable it either by
  759. reconfiguring the driver, or by sending the control sequence to
  760. disable the graphics cursor. A batch file, GCOFF.BAT, has been 
  761. provided for this purpose.
  762.  
  763.  
  764. TEXT DISPLAY IS MESSED UP, POSSIBLY CHANGING COLORS IN UNUSUAL
  765. PLACES. 
  766.  
  767. This has been observed with programs using the BIOS for writing
  768. to the display, and not expecting the ANSI translation (or the
  769. conversion of the TAB character into spaces instead of a special
  770. graphic). Execute NOBIOSW.BAT to turn the ANSI translation off
  771. for these programs.  PROCOMM and Typing Tutor IV have this problem.
  772.  
  773.  
  774. CANNOT SET VESA STANDARD EXTENDED DISPLAY MODES
  775.  
  776. You must compile the driver with VESA defined as TRUE, and then
  777. must request a mode 128 less than that really desired. There are also
  778. problems with boards having built-in VESA support without using a software
  779. VESA driver; for these boards you will need to set the display mode using
  780. the mode changing software supplied by the vendor.
  781.  
  782.  
  783. THE MODE COMMAND DOES NOT CHANGE THE NUMBER OF DISPLAY LINES
  784.  
  785. The mode command does not function if NNANSI is loaded as a limited
  786. TSR -- install as a full TSR or as a device driver. Also, you might
  787. need to reassemble with "dos4 EQU TRUE", as it is in the distribution
  788. NNANSI driver. 
  789.  
  790.  
  791. A TSR OR REMOTE OPERATION PROGRAM DOES NOT WORK WITH NNANSI BUT DOES WITH ANSI
  792.  
  793. NNANSI is incompatible with programs that expect the ANSI driver to
  794. write to the display using BIOS calls. I recommend the use of the
  795. program ANSI.COM, from PC Magazine, for these uses.
  796.  
  797.  
  798. I USE 4DOS AND CANNOT ALIAS F11 AND F12
  799.  
  800. You need to recompile with ext_keybd set to TRUE.
  801.  
  802.  
  803. THE KEYBOARD REASSIGNMENT COMMAND DOES NOT SEEM TO BE WORKING
  804.  
  805. By default it is disabled to prevent "ANSI BOMBS". You will need to 
  806. recompile with key_redef set to TRUE.
  807.  
  808.  
  809.  
  810. *****************NNANSI COMMAND SEQUENCES
  811.  
  812. Command sequences start with the escape character (code 27,
  813. referred to in this section as ESC). NNANSI buffers up the
  814. sequence until it has a command to execute. If the sequence is
  815. not a valid command, the entire sequence is passed to the display.
  816.  
  817. All command sequences have the following format:
  818.  
  819.    ESC [ param1; param2; ...; paramN cmdchar
  820.  
  821. where
  822.        ESC     is the escape character
  823.        [       is the left bracket character.
  824.        param   are ascii decimal numbers or quoted strings.
  825.        cmdchar is the command character
  826.  
  827. No spaces are allowed within the command.
  828.  
  829. Missing arguments are defaulted to "1" unless otherwise specified
  830. (SGR, ED, and IBMKKR).
  831.  
  832. Quoted strings may use either single or double quote characters
  833. as delimiters. Each character inside the quoted string is
  834. converted to a numeric parameter. Quoted strings are only useful
  835. for the questionable Keyboard Key Reassignment command.
  836.  
  837.  
  838.  
  839.                    CURSOR POSITIONING COMMANDS
  840.  
  841. NAME    DESCRIPTION             COMMAND
  842. CUP     cursor position         ESC[y;xH
  843. HVP     cursor position         ESC[y;xf
  844.  
  845.         Either of these set the cursor position. CUP should be
  846.         used since HVP has other connotations not implemented in
  847.         NNANSI (or ANSI.SYS). The origin (in the upper left
  848.         corner) is x=1, y=1.
  849.  
  850. CUU     cursor up               ESC[nA
  851. CUD     cursor down             ESC[nB
  852.         n = # of lines to move. You cannot move beyond the edge
  853.         of the display.
  854.  
  855. CUF     cursor forward          ESC[nC
  856. CUB     cursor backward         ESC[nD
  857.         n = # of columns to move. You cannot move beyond the
  858.         edge of the display.
  859.  
  860. DSR     Device Status Report    ESC[6n
  861.         Find out cursor position. The driver responds with a
  862.         cursor position report (CPR) of the form "ESC[y;xR"
  863.         followed by a carriage return, as if typed at the
  864.         keyboard. 
  865.  
  866. SCP     Save Cursor Position    ESC[s
  867. RCP     Restore Cursor Position ESC[u
  868.         Cannot be nested.
  869.  
  870.  
  871.  
  872.  
  873.                         EDITING COMMANDS
  874.  
  875. NAME    DESCRIPTION             COMMAND
  876. ED      Erase in Display        ESC[nJ
  877.         n=0 or missing: Erase to end of screen (not in ANSI.SYS)
  878.         n=1: erase to start of screen (not in ANSI.SYS)
  879.         n=2: erase entire screen, and home cursor
  880.         Note: there is a bug in ANSI.SYS that performs function
  881.         2 regardless of the value of n. This bug is not repeated
  882.         in NNANSI because of the extra functionality provided.
  883.     Everybody's "ANSI.SYS" homes the cursor, which the standard
  884.     does not call for, and NNANSI keeps up that tradition.
  885.  
  886. EL      Erase in Line           ESC[K
  887.         Erases from cursor to end of line.
  888.  
  889. IL      Insert Lines            ESC[nL 
  890.         Inserts n blank lines at the line containing the cursor.
  891.         While the cursor line moves down, the cursor position is
  892.         unchanged. Not in ANSI.SYS. 
  893.  
  894. DL      Delete Lines            ESC[nM  
  895.         Deletes n lines, starting at the line containing the
  896.         cursor. The cursor is not moved. Not in ANSI.SYS
  897.         
  898. ICH     Insert Characters       ESC[n@  
  899.         Inserts n blank characters at cursor position. The
  900.         cursor does not move. Not in ANSI.SYS. Does not work in
  901.         graphic modes.
  902.  
  903. DCH     Delete Characters       ESC[nP  
  904.         Deletes n characters at the cursor. The cursor does not
  905.         move. Not in ANSI.SYS. Does not work in graphic modes.
  906.  
  907.  
  908.  
  909.  
  910.                   SET GRAPHIC RENDITION COMMAND
  911.  
  912. NAME    DESCRIPTION             COMMAND
  913. SGR     Set Graphics Rendition  ESC[n;n;...nm
  914.  
  915. The Set Graphics Rendition command is used to select foreground
  916. and background colors or attributes.  When you use multiple
  917. parameters, they are executed in sequence, and the effects are
  918. cumulative.  You can set all colors and attributes in any text
  919. mode.  In 16 color graphic modes between 640x350 and 800x600
  920. pixels you can set all colors and attributes except for blink.
  921. "Blink" becomes exclusive-OR character mode (very useful!).  You
  922. can set foreground colors, blink, and bold, only, in other 16 color
  923. modes.  Setting colors does not work correctly for other color
  924. modes -- make sure display is in the normal white on black mode
  925. before changing to these modes.
  926.  
  927. When a Monochrome Display Adapter (MDA) is used, foreground and
  928. background colors other than black and white should not be set. The
  929. MDA also ignores the underscore and bold attributes while in reverse
  930. video.
  931.  
  932. If no arguments are given, a single "0" argument is assumed. If multiple
  933. arguments are given, missing arguments are taken to be "0".
  934.  
  935.  
  936. Code          Value
  937. 0               All attributes off (normal white on black)
  938. 1               Bold
  939. 2               Dim (not Bold)
  940. 4               Underscore (emulated via blue foreground in CGA/EGA/VGA)
  941. 5               Blink (or EXOR -- see above)
  942. 7               Reverse Video (improved implementation over ANSI)
  943. 8               Invisible (improved operation -- foreground color
  944.         forced to background color, other attributes suppressed)
  945. 22              Cancel Bold
  946. 24              Cancel Underline (white foreground)
  947. 25              Cancel Blink
  948. 27              Cancel Reverse video
  949. 28        Cancel Invisible
  950. 30-37           foreground black/red/green/yellow/blue/magenta/cyan/white
  951. 40-47           background black/red/green/yellow/blue/magenta/cyan/white
  952.  
  953. Codes 2, 22, 24, 25, 27, and 28 are not in ANSI.SYS.
  954.  
  955.  
  956.  
  957.                     SET DISPLAY MODE COMMAND
  958.  
  959. NAME    DESCRIPTION             COMMAND
  960. SM      Set Mode                ESC[=nh
  961. RM      Reset Mode              ESC[=nl
  962.  
  963. The set and reset mode commands are identical in this context.
  964.  
  965. The BIOS supports many video modes. The code given for the AL
  966. register to the BIOS set mode command is used as the parameter to
  967. this set mode command. That means that extended modes that are
  968. settable in this manner can use this command. As an example, with the
  969. Diamond Speedstar, the command ESC[=34h will set 132 column by 44 row
  970. mode. Display cards that use other techniques to change display mode
  971. are left as an exercise to the user, but if you can get the card into
  972. an extended mode, NNANSI can used it (possibly with a configuration
  973. change, though).
  974.  
  975. VESA Display Cards: To set VESA modes, select a mode 128 less than the
  976. desired mode number. For instance, for 132x43 text mode, select mode
  977. 138 (rather than 266). 
  978.  
  979. Monochrome Display Adapter (MDA): These commands are ignored when the
  980. MDA is in use.
  981.  
  982. In the graphic modes, the cursor can be simulated with a blob
  983. (the character produced with character code 22).
  984.  
  985. Mode Code       Value
  986.     0,1         text 40x25 16 color
  987.     2,3         text 80x25 16 color
  988.     4,5         graphics 320x200 4 color
  989.     6           graphics 640x200 Black & White
  990.     7        cursor wrap (see SET DISPLAY ATTRIBUTES, below)
  991.     13          graphics 320x200 16 color, VGA only
  992.     14          graphics 640x200 16 color, VGA only
  993.     16          graphics 640x350 16 color, VGA only
  994.     17          graphics 640x480 Black & White, VGA only
  995.     18          graphics 640x480 16 color, VGA only
  996.     19          graphics 300x200 256 color, VGA only
  997.     43          43 line mode for modes 0-3 (Not in ANSI.SYS)
  998.     50          50 line mode for modes 0-3 (VGA only, not in
  999.                 ANSI.SYS)
  1000.     n           When not in above list, sets mode n. (Not in
  1001.                 ANSI.SYS) 
  1002.  
  1003.  
  1004. The modes marked as VGA only are not supported by ANSI.SYS
  1005. that comes with version 3.3 MS-DOS or earlier.
  1006.  
  1007. The 43 line and 50 line support reprograms the display to use smaller
  1008. characters. You must be in mode 3 (80x25) or 1 (40x25) for this
  1009. command to work. Set any other mode to leave 43/50 line mode. Unlike
  1010. early version of NNANSI and other drivers, reselecting  the same line
  1011. number mode (mode 3 (or 1), 43, or 50) will not cause the display to
  1012. clear. This makes it possible to put a 43 (or 50) line command within
  1013. the dos prompt to force this mode upon entering or returning to DOS.
  1014. For example, you can have 43 line mode automatically selected at the
  1015. DOS prompt by issuing this command:
  1016.  
  1017.     prompt $e[=43h$p$g
  1018.  
  1019. Unlike earlier versions of NNANSI, and NANSI.SYS, setting 43 line
  1020. mode on a VGA will give 43 (not 50) lines. You must use the explicit
  1021. 50 line mode command to get 50 lines on a VGA. If you would rather
  1022. have compatibility with these other, earlier drivers, recompile the
  1023. driver with VGA set to FALSE.
  1024.  
  1025. Under MS/PC DOS Version 4.0 (and later), the number of lines can
  1026. also be set using the MODE command. For instance, to set 43 line mode
  1027. under DOS 4.0, issue the command:
  1028.  
  1029.     mode con lines=43
  1030.  
  1031. Note that in older versions of NNANSI, and NANSI.SYS, the use of
  1032. the = character in the command was optional, and a ? could be used
  1033. instead. That is not true for this version.
  1034.  
  1035.  
  1036.                      SET DISPLAY ATTRIBUTES
  1037.  
  1038. NAME    DESCRIPTION             COMMAND
  1039. SM      Set Mode                ESC[?nh
  1040. RM      Reset Mode              ESC[?nl
  1041.  
  1042. Valid attributes that can be set and reset:
  1043.  
  1044. 7       Cursor Wrap     When false, cursor sticks at end of
  1045.                         line, rather than wrapping
  1046.  
  1047. 97    ANSI Bios    When true, calls of the bios write_tty
  1048.                         function will be processed by NNANSI,
  1049.             allowing processing of ANSI escape sequences.
  1050.             When false, processing will not occur. Some
  1051.             programs will not work properly if set to true.
  1052.  
  1053. 98      Fast Scroll     When true (fast mode) the starting
  1054.                         display location is changed for fast
  1055.                         scrolling, which can cause problems for
  1056.                         some programs. When false, the starting
  1057.                         location does not change and the
  1058.                         multi-page support is enabled.
  1059.  
  1060. 99      Graphic cursor  When true the cursor is displayed in
  1061.                         graphic modes. Some programs produce ghost
  1062.             cursors when set to true.
  1063.  
  1064. Batch files are supplied to change attributes 97, 98, and 99.
  1065.  
  1066. Note that the Fast Scroll attribute does not apply to the Monochrome
  1067. Display Adapter (MDA). Also note that in older versions of
  1068. NNANSI, and NANSI.SYS, the use of the ? character in the command
  1069. was optional, and an = could be used instead. That is not true for
  1070. this version. Because some Microsoft documentation claims that the
  1071. = character can be used for Cursor Wrap, NNANSI still supports that
  1072. bug.
  1073.  
  1074.  
  1075.  
  1076.                   KEYBOARD REASSIGNMENT COMMAND
  1077.  
  1078. This command is absent by default. You must recompile to enable
  1079. this command. Use of this feature is not recommended.
  1080.         
  1081. NAME    DESCRIPTION             COMMAND
  1082. IBMKKR  Keyboard Key Reassign   ESC[param;param;...;param p
  1083.  
  1084. If no parameters are given, all keys are reset. This is not true
  1085. for ANSI.SYS.
  1086.  
  1087. The first parameter is the key to reassign. IBM function keys take
  1088. the first two parameters, where the first parameter is 0.  The
  1089. remaining parameters are the keystrokes to substitute. Extended keys
  1090. are supported -- they have 224 as the first parameter and the scan
  1091. code as the second. Unassigned extended characters are automatically
  1092. mapped to their non-extended counterparts.  Normally a string is used
  1093. rather than numeric arguments. See your DOS manual for the chart of
  1094. keycodes.
  1095.  
  1096. For example, to have F5 do a DIR command, you would execute
  1097.  
  1098. ESC[0;63;"DIR";13p
  1099.  
  1100. To restore the key to its original function, assign it its original codes:
  1101.  
  1102. ESC[0;63;0;63p
  1103.  
  1104. ******************************THE END****************************
  1105.